#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int longestOnes(vector<int>& nums, int k) {
        int hash[2] = { 0 };
        int left = 0, right = 0, len = nums.size();
        int maxlen = 0;
        while (right < len) {
            hash[nums[right]]++;
            while (hash[0] > k)
                hash[nums[left++]]--;
            maxlen = max(maxlen, right - left + 1);
            right++;
        }
        return maxlen;
    }
};

int main() {


	return 0;
}